﻿using System.Web.Mvc;

namespace Yunzuan.Foundation.Web.MVC
{
    public class CacheFilterAttribute : ActionFilterAttribute
    {
        public bool IsCache { get; set; }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!this.IsCache)
            {
                filterContext.HttpContext.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
                filterContext.HttpContext.Response.Cache.SetNoStore();
            }
            base.OnActionExecuting(filterContext);
        }
    }
}
